package com.baidu.mapper;

import com.baidu.entity.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SysUserMapper extends BaseMapper<SysUser>{
    @Select("SELECT * FROM user")
    List<SysUser> selectListAll();

    @Insert("INSERT INTO user VALUES (#{id},#{username},#{password},#{email},#{sex},#{phone})")
    boolean insertOne(SysUser user);

    @Select("SELECT * FROM user WHERE username = #{username} LIMIT 1")
    SysUser findUserByUsername(String username);

    @Delete("delete from user where id=#{id}")
    boolean deleteUserByUsername(Integer id);

    @Update("update user set username = #{username},password = #{password},email=#{email}, sex=#{sex}, phone=#{phone} where id=#{id}")
    boolean updataUserByUsername(SysUser user);

    List<SysUser> list (String username,String email,Integer sex,String phone);
}
